<template>

	<view class="container">

		<view class="wechatapp">
			<!-- <view class="header">
        <image class="image" :src="imgurl+userBackdropImg" mode="widthFix"></image>
      </view> -->
			<view class="user-info">
				<view class="user-arr">
					<image :src="userHead?imgurl+userHead:'/static/images/arr_img.png'"></image>
				</view>
				<view class="info-k">
					<view class="info-name" v-if="!islogin">
						{{islogin?userOffice:"Hi~您好,请登录"}}
					</view>
					<view class="info-name-index" v-if="islogin">
						<text>{{userOffice}}</text>
					</view>
					<view class="info-phone" v-if="islogin&&userMobile">

						<text class="info-username">{{userCode?userCode:userName}}</text> <text
							class="info-usermobile">（{{userMobile?userMobile:"----"}}）</text>
					</view>
					<view class="info-phone" v-if="islogin&&!userMobile">

						<text class="info-username">{{userName?userName:'----'}}</text> <text
							class="info-usermobile">（{{userCode?userCode:"----"}}）</text>
					</view>
				</view>
				<view class="infon_login" v-if="islogin" @click="gologinout">
					退出登录
				</view>
				<view class="infon_login" v-if="!islogin" @click="gologin">
					登录活动
				</view>
			</view>

		</view>



		<view class="contenthd-k">

			<view class="content-item item-left" @click="goactivity">
				<view class="content-icom">
					<image src="/static/images/home1.png" class="icon_hd"></image>
				</view>
				<view class="content-title">
					<text>参加活动</text>
					<view class="content-title-in">
						<!-- 进入活动参与活动 -->
					</view>
				</view>

			</view>
			<view class="content-item item-rigit" @click="gohistory">
				<view class="content-title">
					<text>历史记录</text>
					<view class="content-title-in">
						查看参与过的活动
					</view>
				</view>
				<view class="content-icom">
					<image src="/static/images/home2.png" class="icon_jl"></image>
				</view>
				<!-- <view class="content-title">
				<text>历史记录</text>
				<image src="/static/images/icon_jt.png" ></image>
			</view> -->
			</view>
		</view>


		<view class="contenthd-k">

			<view class="content-item item-left item-bt-left" @click="goinfo">
				<view class="content-icom">
					<image src="/static/images/home4.png" class="icon_hd"></image>
				</view>
				<view class="content-title">
					<text>编辑资料</text>
					<view class="content-title-in">
						进入编辑个人信息
					</view>
				</view>

			</view>
			<view class="content-item item-bt-rigit">
				<view class="bt_infon">
					<view class="bt_infon_item bt_infon_item-lx" @click="lxfun">
						<view class="bt_infon_item_icom">
							<image src="/static/images/home5.png" class="icon_cart"></image>
						</view>
						<view class="bt_infon_item_name">
							联系我们
						</view>
					</view>
					<view class="bt_infon_item bt_infon_item-kf" @click="cenct">
						<view class="bt_infon_item_name">
							在线客服
						</view>
						<view class="bt_infon_item_icom">
							<image src="/static/images/home6.png" class="icon_kf"></image>
						</view>

					</view>
				</view>
			</view>
		</view>
		<!-- <view class="contenthd-onek">

			<view class="content-item" @click="goarulesfun">
				<view class="content-icom">
					<image src="/static/images/home3.png" class="icon_hd"></image>
				</view>
				<view class="content-title">
					<text>规则介绍</text>
					<view>
						了解文体活动平台功能
					</view>
				</view>
			</view>

		</view> -->



	</view>
</template>

<script>
	import {
		sendUserCode,
		userLogin
	} from "@/api/login/login";
	import {
		BASE_URL_IMAHE
	} from "../../../utils/https";
	import {
		getUserInfo
	} from "@/api/index/index";
	const app = getApp();
	export default {
		data() {
			return {
				imgurl: BASE_URL_IMAHE,
				islogin: false,
				userRef: "",
				userMobile: "",
				userCode: "",
				userName: '',
				userHead: "",
				userOffice: "",
				userBackdropImg: "",
				longinType: 0,
			};
		},

		created() {},
		beforeDestroy() {

		},
		onLoad() {

			this.longinType = uni.getStorageSync("longinType") ? uni.getStorageSync("longinType") : 0





		},
		onReady() {


		},
		onShow() {

			console.log("2options")
			this.userBackdropImg = uni.getStorageSync('userBackdropImg') ? uni.getStorageSync('userBackdropImg') : ""
			// if(uni.getStorageSync("type")=="chess"){
			if (uni.getStorageSync("scjhuserRef")) {
				// this.$nextTick(()=>{
				// 	this.userRef=uni.getStorageSync("userRef")
				// 	this.userMobile=uni.getStorageSync("userMobile")
				// 	this.userCode=uni.getStorageSync("userCode")
				// 	this.userName=uni.getStorageSync("userName")
				// 	this.userOffice=uni.getStorageSync("userOffice")
				// 	this.userHead=uni.getStorageSync("userHead")
				// })
				this.getUserInfofun()


				this.islogin = true
			} else {


				this.islogin = false
			}

			console.log('sds', uni.getStorageSync("userName"), uni.getStorageSync("userCode"), this.userName)
			// }
			// if(uni.getStorageSync("type")=="sport"){
			// 		  if(uni.getStorageSync("usersportRef")){
			// 		  		  this.userRef=uni.getStorageSync("usersportRef")
			// 		  		  this.userMobile=uni.getStorageSync("usersportMobile")
			// 		  		  this.userCode=uni.getStorageSync("usersportCode")

			// 		  		  this.islogin=true
			// 		  }else {


			// 		  		   this.islogin=false
			// 		  }
			// 		  // this.form.userRef=uni.getStorageSync("usersportRef")	
			// }
			// if(uni.getStorageSync("type")=="walk"){
			// 		  if(uni.getStorageSync("userwalkRef")){
			// 		  		  this.userRef=uni.getStorageSync("userwalkRef")
			// 		  		  this.userMobile=uni.getStorageSync("userwalkMobile")
			// 		  		  this.userCode=uni.getStorageSync("userwalkCode")

			// 		  		  this.islogin=true
			// 		  }else {


			// 		  		   this.islogin=false
			// 		  }
			// 		  // this.form.userRef=uni.getStorageSync("usersportRef")	
			// }

			// if(uni.getStorageSync("type")=="study"){
			// 		  if(uni.getStorageSync("userstudyRef")){
			// 		  		  this.userRef=uni.getStorageSync("userstudyRef")
			// 		  		  this.userMobile=uni.getStorageSync("userstudyMobile")
			// 		  		  this.userCode=uni.getStorageSync("userstudyCode")

			// 		  		  this.islogin=true
			// 		  }else {


			// 		  		   this.islogin=false
			// 		  }
			// 		  // this.form.userRef=uni.getStorageSync("usersportRef")	
			// }

		},
		methods: {
			async getUserInfofun() {
				const res = await getUserInfo(JSON.stringify({
					userId: uni.getStorageSync("userId")
				}))
				console.log(res)

				this.userName = res.user && res.user.userName ? res.user.userName : ""
				this.userOffice = res.user && res.user.userOffice ? res.user.userOffice : ""
				this.userHead = res.user && res.user.userHead
				this.userCode = res.user && res.user.userCode ? res.user.userCode : ""
				this.userMobile = res.user && res.user.userMobile


			},
			goarulesfun() {
				uni.navigateTo({
					url: "/pages/rules/index"
				})
			},
			goinfo() {
				// #ifdef MP-WEIXIN
				if (!uni.getStorageSync("v")) {
					uni.showToast({
						title: "获取配置失败，\r\n请扫码进入",
						icon: "none"
					})
					return
				}
				// #endif
				// if(uni.getStorageSync("type")=="chess"){
				if (uni.getStorageSync("scjhuserRef")) {
					uni.navigateTo({
						url: "/pages/myupdate/index"
					})
				} else {
					uni.showToast({
						title: "您还未登录，即将进入登录",
						icon: "none"
					})
					setTimeout(() => {
						uni.navigateTo({
							url: "/pages/empower/register"
						})
					}, 1500)

				}

			},
			lxfun() {
				console.log(uni.getStorageSync("servicePhone"), uni.getStorageSync("serviceUrl"))
				uni.makePhoneCall({
					phoneNumber: uni.getStorageSync("servicePhone"), // 电话号码
					success: function() {
						console.log('拨号成功');
					},
					fail: function() {
						console.log('拨号失败');
					}
				});
			},
			cenct() {
				// #ifdef MP-WEIXIN
				// Customer
				uni.redirectTo({
					url: "/pages/cantent/index"
				})
				return
				// #endif

				window.location.href = uni.getStorageSync("serviceUrl")
			},
			gologin() {
				// #ifdef MP-WEIXIN
				if (!uni.getStorageSync("v")) {
					uni.showToast({
						title: "获取配置失败，\r\n请扫码进入",
						icon: "none"
					})
					return
				}
				// #endif
				uni.navigateTo({
					url: "/pages/empower/register"
				})
			},
			gologinout() {
				// if(uni.getStorageSync("type")=="chess"){
				uni.removeStorageSync("scjhuserRef")
				uni.removeStorageSync("userMobile")
				uni.removeStorageSync("userCode")
				// }
				// if(uni.getStorageSync("type")=="sport"){
				// 		uni.removeStorageSync("usersportRef")
				// 		uni.removeStorageSync("usersportMobile")
				// 		uni.removeStorageSync("usersportCode")
				// }
				// if(uni.getStorageSync("type")=="walk"){
				// 		uni.removeStorageSync("userwalkRef")
				// 		uni.removeStorageSync("userwalkMobile")
				// 		uni.removeStorageSync("userwalkCode")
				// }
				// if(uni.getStorageSync("type")=="study"){
				// 		uni.removeStorageSync("userstudyRef")
				// 		uni.removeStorageSync("userstudyMobile")
				// 		uni.removeStorageSync("userstudyCode")
				// }


				this.islogin = false
			},
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
				// console.log('close');
			},
			gohistory() {
				// #ifdef MP-WEIXIN
				if (!uni.getStorageSync("v")) {
					uni.showToast({
						title: "获取配置失败，\r\n请扫码进入",
						icon: "none"
					})
					return
				}
				// #endif
				// if(uni.getStorageSync("type")=="chess"){
				if (uni.getStorageSync("scjhuserRef")) {
					uni.navigateTo({
						url: "/pages/history/index"
					})
				} else {
					uni.showToast({
						title: "您还未登录，即将进入登录",
						icon: "none"
					})
					setTimeout(() => {
						uni.navigateTo({
							url: "/pages/empower/register"
						})
					}, 1500)
				}
				// }
				// if(uni.getStorageSync("type")=="sport"){
				// 			  if(uni.getStorageSync("usersportRef")){
				// 			  			  uni.navigateTo({
				// 			  			  	url:"/pages/history/index"
				// 			  			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  				icon:"none"
				// 			  			  })
				// 			  			  setTimeout(()=>{
				// 			  			  						uni.navigateTo({
				// 			  			  							url:"/pages/empower/register"
				// 			  			  						})   
				// 			  			  },1500)
				// 			  }
				// }
				// if(uni.getStorageSync("type")=="walk"){
				// 			  if(uni.getStorageSync("userwalkRef")){
				// 			  			  uni.navigateTo({
				// 			  			  	url:"/pages/history/index"
				// 			  			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  				icon:"none"
				// 			  			  })
				// 			  			  setTimeout(()=>{
				// 			  			  						uni.navigateTo({
				// 			  			  							url:"/pages/empower/register"
				// 			  			  						})   
				// 			  			  },1500)
				// 			  }
				// }

				// if(uni.getStorageSync("type")=="study"){
				// 			  if(uni.getStorageSync("userstudyRef")){
				// 			  			  uni.navigateTo({
				// 			  			  	url:"/pages/history/index"
				// 			  			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  				icon:"none"
				// 			  			  })
				// 			  			  setTimeout(()=>{
				// 			  			  						uni.navigateTo({
				// 			  			  							url:"/pages/empower/register"
				// 			  			  						})   
				// 			  			  },1500)
				// 			  }
				// }



			},
			goactivity() {
				// #ifdef MP-WEIXIN
				if (!uni.getStorageSync("v")) {
					uni.showToast({
						title: "获取配置失败，\r\n请扫码进入",
						icon: "none"
					})
					return
				}
				// #endif
				// if(uni.getStorageSync("type")=="chess"){
				if (uni.getStorageSync("scjhuserRef")) {
					uni.navigateTo({
						url: "/pages/activity/index"
					})
				} else {
					uni.showToast({
						title: "您还未登录，即将进入登录",
						icon: "none"
					})
					setTimeout(() => {
						uni.navigateTo({
							url: "/pages/empower/register"
						})
					}, 1500)

				}
				// }
				// if(uni.getStorageSync("type")=="sport"){
				// 			  if(uni.getStorageSync("usersportRef")){
				// 			  uni.navigateTo({
				// 			  	url:"/pages/activity/index"
				// 			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  						icon:"none"
				// 			  			  })
				// 			  					  setTimeout(()=>{
				// 			  						uni.navigateTo({
				// 			  							url:"/pages/empower/register"
				// 			  						})   
				// 			  					  },1500)

				// 			  }
				// }
				// // walk
				// if(uni.getStorageSync("type")=="walk"){
				// 			  if(uni.getStorageSync("userwalkRef")){
				// 			  uni.navigateTo({
				// 			  	url:"/pages/activity/index"
				// 			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  						icon:"none"
				// 			  			  })
				// 			  					  setTimeout(()=>{
				// 			  						uni.navigateTo({
				// 			  							url:"/pages/empower/register"
				// 			  						})   
				// 			  					  },1500)

				// 			  }
				// }

				// // walk
				// if(uni.getStorageSync("type")=="study"){
				// 			  if(uni.getStorageSync("userstudyRef")){
				// 			  uni.navigateTo({
				// 			  	url:"/pages/activity/index"
				// 			  }) 
				// 			  }else{
				// 			  			  uni.showToast({
				// 			  			  	title:"您还未登录，即将进入登录",
				// 			  						icon:"none"
				// 			  			  })
				// 			  					  setTimeout(()=>{
				// 			  						uni.navigateTo({
				// 			  							url:"/pages/empower/register"
				// 			  						})   
				// 			  					  },1500)

				// 			  }
				// }

			},

		}


	};
</script>

<style lang="scss" scoped>
	.btstyle {
		width: 165rpx;
		background: #0065ff;
		color: white;
	}

	u-checkbox-group::v-deep {
		.u-checkbox__label {
			margin-right: rpx(0);
		}
	}

	.icon-cone {
		margin-right: 10rpx;
	}

	.checkBox_wrapper {
		font-size: rpx(12);
		display: flex;
	}

	.container {
		width: 750rpx;
		padding: 0 0rpx;
		font-size: 32rpx;
		background: #fff;
		min-height: 100vh;
		position: relative;
	}

	.back_img {
		position: absolute;
		top: 80rpx;
		right: 0rpx;
		z-index: 1;

		image {
			width: 350rpx;
		}
	}

	.login-test {
		margin-top: rpx(20);

		display: flex;
		justify-content: center;

		.login-item {
			width: rpx(80);
			height: rpx(80);
			text-align: center;
			margin-left: rpx(20);
			margin-right: rpx(20);

			.login-text {
				width: 100%;
				font-size: rpx(15);
				line-height: rpx(35);
			}

			.login-icom {

				// width: rpx(48);
				// height: rpx(48);
				// border-radius: 50%;
				// border: rpx(3) solid black;
				// margin: 0 auto;
				.login-icoms {}
			}
		}
	}

	.wechatapp {
		//border-bottom: 1rpx solid #e3e3e3;
		// margin-bottom: 72rpx;
		text-align: center;
		width: 100%;
		height: 170rpx;
		background-color: #e6e6e6;
		overflow: hidden;
		position: relative;

		.header {
			width: 100%;
			height: 100%;



			.image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.auth-title {
		color: #585858;
		font-size: 60rpx;
		margin-bottom: 40rpx;
		margin-left: 40rpx;
		margin-top: 80rpx;
	}

	.auth-phonetitle {
		color: #585858;
		font-size: 30rpx;
		margin-bottom: 40rpx;
		margin-left: 40rpx;
		line-height: 60rpx;
		margin-top: 80rpx;
	}

	.auth-subtitle {
		color: #888;
		margin-bottom: 88rpx;
		font-size: 60rpx;

	}

	.login-view {
		width: 100%;
		box-sizing: border-box;
		padding: 0 rpx(20);
	}

	.login-btn-qk {
		font-size: 30rpx;
		text-align: right;
		margin-right: 40rpx;
		margin-top: 40rpx;
	}

	.content-k {
		display: flex;
		justify-content: space-between;
		padding: 60rpx 48rpx 0rpx;
	}

	.user-info {
		position: absolute;
		padding: 0rpx 54rpx;
		left: 0rpx;
		bottom: 40rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;

		.user-arr {
			width: 94rpx;
			height: 94rpx;
			border-radius: 50%;

			image {
				width: 94rpx;
				height: 94rpx;
				border-radius: 50%;
			}
		}

		.info-k {
			width: 380rpx;
			// background-color: red;
			text-align: left;
			box-sizing: border-box;
			padding-left: 18rpx;

			.info-name {
				font-weight: 600;
				font-size: 36rpx;
				color: #000000;
				line-height: 46rpx;
			}

			.info-name-index {
				font-weight: 600;
				font-size: 36rpx;
				color: #000000;
				line-height: 46rpx;

				text {
					// padding: 5rpx 20rpx;
					// background-color: rgba(0, 0, 0, 0.2);
					border-radius: 35rpx;

				}
			}

			.info-phone {
				font-weight: 400;
				font-size: 29rpx;
				color: #787878;
				line-height: 37rpx;

				.info-username {
					font-size: 26rpx;
				}
			}
		}

		.infon_login {
			display: inline;
			width: auto;
			// height: 60rpx;
			font-size: 28rpx;
			border-radius: 45rpx;
			// line-height: 60rpx;
			padding: 8rpx 15rpx;
			color: white;
			white-space: nowrap;
			background-color: #434343;
		}
	}

	.contenthd-k {
		width: 100%;
		display: flex;
		justify-content: center;
		padding: 0rpx 0rpx;
		margin-top: 60rpx;

		box-sizing: border-box;
		color: white;
		font-size: 28rpx;

		.content-item {
			width: 313rpx;
			height: auto;

			border-radius: 16rpx;
			position: relative;
			box-sizing: border-box;
			padding: 20rpx;
			margin: 0 16rpx;
			border-radius: 25rpx;

			.icon_jl {
				width: 160rpx;
				height: 150rpx;
				margin-top: 30rpx;
				margin-left: 110rpx;
			}

			.icon_hd {

				width: 160rpx;
				height: 150rpx;
			}
		}

		.item-rigit {
			padding-top: 40rpx;
			background: linear-gradient(90deg, #FFD008, #FFD907);

			.content-title {
				margin-top: 10rpx;
				font-weight: 600;
				font-size: 36rpx;
				color: #F7F9FA;

				view {
					font-weight: 600;
					font-size: 26rpx;
					color: #F7F9FA;
					margin-top: 19rpx;
				}
			}

		}

		.item-left {
			padding-top: 40rpx;
			background: linear-gradient(90deg, #FFAD92, #FFA096, #FF8B91, #FF7F87);

			.content-title {
				margin-top: 35rpx;
				font-weight: 600;
				font-size: 36rpx;
				color: #F7F9FA;

				view {
					font-weight: 600;
					font-size: 26rpx;
					color: #F7F9FA;
					margin-top: 19rpx;
				}
			}
		}

		.item-bt-left {
			width: 358rpx;
			padding-top: 25rpx;
			background: linear-gradient(90deg, #8AE7D4, #8CE0E0);

			.icon_hd {
				width: 183rpx;
				height: 176rpx;
				margin-left: 90rpx;
			}

			.content-title {
				margin-top: 25rpx;
				font-weight: 600;
				font-size: 36rpx;
				color: #F7F9FA;

				view {
					font-weight: 600;
					font-size: 26rpx;
					color: #F7F9FA;
					margin-top: 19rpx;
				}
			}
		}

		.item-bt-rigit {
			width: 252rpx;
			box-sizing: border-box;
			background-color: white !important;
			padding: 0 !important;
		}

		.content-item:first-child {
			background-color: #0065ff;
		}

		.content-item:last-child {
			background-color: #feaa48;
		}

		.content-title {
			display: flex;
			flex-direction: column;
			margin-top: 8rpx;

			image {
				width: 13rpx;
				height: 22rpx;
			}
		}
	}

	.bt_infon_item {
		display: flex;
		flex-direction: column;
		text-align: center;
		width: 100%;

		// align-items: flex-end;
		.icon_cart {
			width: 100rpx;
			height: 103rpx;
		}

		.icon_kf {
			width: 49rpx;
			height: 49rpx;
			margin-left: 32rpx;
		}

		.bt_infon_item_name {
			// margin-top: 10rpx;
		}

		.bt_infon_item_name:last-child {
			margin-top: 14rpx;
			font-weight: 600;
			font-size: 32rpx;
			color: #F7F9FA;
			line-height: 42rpx;
		}
	}

	.bt_infon_item-lx {
		width: 252rpx;
		height: auto;
		padding-bottom: 20rpx;
		background: linear-gradient(90deg, #BFB4FF, #E9BFFA);
		border-radius: 16rpx;
		padding-top: 49rpx;
		text-align: right;
		box-sizing: border-box;
		padding-right: 28rpx;
	}

	.bt_infon_item-kf {

		width: 252rpx;
		height: auto;
		margin-top: 22rpx;
		padding: 20rpx 0rpx;
		background: linear-gradient(90deg, #F9BAB1, #FBC9B8);
		border-radius: 16rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: inherit;
		white-space: nowrap;

	}

	.contenthd-onek {
		width: 100%;


		.content-item {
			width: 648rpx;
			// height: 299rpx;
			min-height: 299rpx;
			height: auto;
			background: linear-gradient(90deg, #3184ED, #54C8F1);
			border-radius: 16rpx;
			margin: 0 auto;
			margin-top: 30rpx;
			position: relative;

			.content-icom {
				width: 200rpx;
				height: 200rpx;
				position: absolute;
				bottom: 0;
				left: 70rpx;

				image {
					width: 100%;
					height: 100%;
				}

			}

			.content-title {
				text-align: right;
				position: absolute;
				bottom: 69rpx;
				right: 25rpx;

				text {
					font-weight: 600;
					font-size: 36rpx;
					color: #F7F9FA;
					line-height: 46rpx;
				}

				view {
					margin-top: 32rpx;
					font-weight: 600;
					font-size: 26rpx;
					color: #F7F9FA;
					line-height: 33rpx;
				}
			}
		}
	}
</style>